<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>原型链检测之instanceof</title>
</head>
<body>
    <script>
        function A(){}
        let a = new A();
        // instanceof是判断 a的原型链上有没有A.prototype
        console.log(a instanceof A);

        function B(){}
        let b = new B();
        Object.setPrototypeOf(a,b);
        // 判断 a的原型链上有没有B.prototype(B.prototype其实就是a)
        console.log(a instanceof B);
        console.log(b instanceof B);

        function C(){}
        let c = new C();
        Object.setPrototypeOf(b,c);
        console.log(a instanceof C);
        console.log(b instanceof C);
        console.log(c instanceof C);
    </script>
</body>
</html>